package demo.day08;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/7/26-07-26-16:35
 * @Description：demo.day08   this
 *   this
 *        用法一：区分局部变量和成员变量
 *        用法二：在非静态方法中调用另一个非静态方法
 *        用法三：调用构造器
 */
public class day08_demo {
    String name;
    public day08_demo(){}
    public day08_demo(String name){
        this.name = name;
        //用法一：区分局部变量和成员变量
        System.out.println(this.name);
    }
    public void test1(){
        this.test2();    //this可省略不写
    }
    public void test2(){
        System.out.println("day08_demo.test2");
    }
    public static void main(String[] args) {
        day08_demo demo = new day08_demo("hjy");
        demo.test1();
    }
}
